package com.ztt.mapper;

import com.ztt.pojo.entity.zttSupplier;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SupplierMapper {

    @Select("select * from suppliers")
    public List<zttSupplier> selectAllSupplier();

    @Insert("insert into suppliers (Supplier_id , Supplier_name , Supplier_short_name , Address , Company_phone , Email , Contact_person , Contact_phone , Notes)"+
            "values (#{supplierID} , #{supplierName} , #{supplierShortName} , #{address} , #{companyPhone} , #{email} , #{contactPerson} , #{contactPhone} , #{notes})")
    public void insertSupplier(zttSupplier supplier);


    @Select("select * from suppliers where Supplier_id = #{supplierID}")
    public zttSupplier getSupplierByID(zttSupplier supplier);


    @Select("select * from suppliers where Supplier_name = #{supplierName}")
    public zttSupplier getSupplierByName(zttSupplier supplier);


    @Update("update suppliers set Supplier_name = #{supplierName} , Supplier_short_name = #{supplierShortName} , Address = #{address} , Company_phone = #{companyPhone} , Email = #{email} , Contact_person = #{contactPerson} , Contact_phone = #{contactPhone} , Notes = #{notes} where Supplier_id = #{supplierID}")
    public void updateSupplier(zttSupplier supplier);

    @Delete("delete from suppliers where Supplier_id = #{supplierID}")
    public void deleteSupplier(zttSupplier supplier);


}
